/*
 * @FilePath: /tads/server/app/business/models/tactics.go
 * @Author: wnina0x0
 * @Date: 2025-04-10 15:20:35
 * @Description:
 *
 * 版权信息 : 2025 by wnina0x0, All Rights Reserved.
 */
package models

import (
	"time"

	"gorm.io/gorm"
)

type Tactics struct {
	ID                        uint           `gorm:"primaryKey;autoIncrement;column:id;comment:主键ID" json:"id"`
	TacticsName               string         `gorm:"size:100;not null;column:tactic_name;comment:战术名称" json:"tactic_name"`
	TacticsDesc               string         `gorm:"type:text;column:tactic_desc;comment:战术描述" json:"tactic_desc"`
	TacticsTypeId             uint           `gorm:"column:tactic_type_id;index;comment:战术方案类型ID" json:"tactic_type_id"`
	TacticsTopoId             uint           `gorm:"column:tactic_topo_id;index;comment:战术拓扑ID" json:"tactic_topo_id"`
	TacticsDbusTypeText       string         `gorm:"not null;type:text;column:tactic_bus_type_text;comment:战术总线类型[list]" json:"tactic_bus_type_text"`
	TacticsAttackMethodIdText string         `gorm:"not null;type:text;column:tactic_attack_method_id_text;comment:战术方案所含攻击技术[list]" json:"tactic_attack_method_id_text"`
	TacticsSceneId            uint           `orm:"column:tactic_scene_id;index;comment:战术所属场景的ID" json:"tactic_scene_id"`
	TacticsIcon               string         `gorm:"type:text;column:scene_icon;comment:战术图标" json:"tactic_icon"`
	IsDeleted                 bool           `gorm:"default:false;column:is_deleted;index;comment:是否删除" json:"is_deleted"`
	Creator                   string         `gorm:"size:50;not null;column:creator;comment:创建者" json:"creator"`
	CreateTime                time.Time      `gorm:"type:timestamp;default:now();not null;column:create_time;comment:创建时间" json:"create_time"`
	Updater                   string         `gorm:"size:50;not null;column:updater;comment:更新者" json:"updater"`
	UpdateTime                time.Time      `gorm:"type:timestamp;default:now();not null;column:update_time;comment:更新时间" json:"update_time"`
	DeletedTime               gorm.DeletedAt `gorm:"index" json:"-"`
}

func (Tactics) TableName() string {
	return "t_tactics"
}

func (s *Tactics) BeforeUpdate(tx *gorm.DB) (err error) {
	s.UpdateTime = time.Now()
	return
}
